$(function () {
    var ue = UE.getEditor("editor",{
        'serverUrl':'/ueditor/upload/',
        'toolbars':[//文本编辑器按钮，一个数组代表一行
            [
            'undo',//按钮，在ueditor官网有所有按钮详情
            'redo',
            'bold',
            'italic',
            'source',
            'blockquote',
            'selectall',
            'insertcode',
            'fontsize',
            'simpleupload',
            'emotion'

            ]
        ]
    });
    window.ue = ue;
});

$(function () {
   $("#comment-btn") .click(function (event) {
       event.propertyIsEnumerable();
       var loginTag = $("#login-tag").attr("data-is-login");
       if (!loginTag){
           window.location = '/signin/';
       }else{
           var content = window.ue.getContent();
           var post_id = $("#post-content").attr("data-id");
           zlajax.post({
               'url':'/acomment/',
               'data':{
                   'content':content,
                   'post_id':post_id
               },
               'success':function(data){
                   if(data['code']==200){
                       window.location.reload();
                   }else{
                       zlalert.alertInfo(data['message']);
                   }
               }
           });
       }

   });
});